package com.ugoodtech.mdcc.core.model.mapper;

import com.ugoodtech.mdcc.core.model.entity.UnionIdOpenId;
import com.ugoodtech.mdcc.core.model.entity.UnionIdOpenIdExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface UnionIdOpenIdMapper {
    @SelectProvider(type=UnionIdOpenIdSqlProvider.class, method="countByExample")
    int countByExample(UnionIdOpenIdExample example);

    @DeleteProvider(type=UnionIdOpenIdSqlProvider.class, method="deleteByExample")
    int deleteByExample(UnionIdOpenIdExample example);

    @Delete({
        "delete from union_id_open_id",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into union_id_open_id (id, union_id, ",
        "open_id, create_time, ",
        "update_time, deleted)",
        "values (#{id,jdbcType=BIGINT}, #{unionId,jdbcType=VARCHAR}, ",
        "#{openId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT})"
    })
    int insert(UnionIdOpenId record);

    @InsertProvider(type=UnionIdOpenIdSqlProvider.class, method="insertSelective")
    int insertSelective(UnionIdOpenId record);

    @SelectProvider(type=UnionIdOpenIdSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="union_id", property="unionId", jdbcType=JdbcType.VARCHAR),
        @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="deleted", property="deleted", jdbcType=JdbcType.BIT)
    })
    List<UnionIdOpenId> selectByExample(UnionIdOpenIdExample example);

    @Select({
        "select",
        "id, union_id, open_id, create_time, update_time, deleted",
        "from union_id_open_id",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="union_id", property="unionId", jdbcType=JdbcType.VARCHAR),
        @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="deleted", property="deleted", jdbcType=JdbcType.BIT)
    })
    UnionIdOpenId selectByPrimaryKey(Long id);

    @UpdateProvider(type=UnionIdOpenIdSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") UnionIdOpenId record, @Param("example") UnionIdOpenIdExample example);

    @UpdateProvider(type=UnionIdOpenIdSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") UnionIdOpenId record, @Param("example") UnionIdOpenIdExample example);

    @UpdateProvider(type=UnionIdOpenIdSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(UnionIdOpenId record);

    @Update({
        "update union_id_open_id",
        "set union_id = #{unionId,jdbcType=VARCHAR},",
          "open_id = #{openId,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "deleted = #{deleted,jdbcType=BIT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(UnionIdOpenId record);
}